<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>历史转出/入记录</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">资金编号</div>
                    <div class="field">
                        <input name="code" id="code" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">收款账号</div>
                    <div class="field">
                        <input name="acceptCode" id="acceptCode" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">来款账号</div>
                    <div class="field">
                        <input name="comeCode" id="comeCode" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">来款户名</div>
                    <div class="field">
                        <input name="comeName" id="comeName" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">可用金额</div>
                    <div class="field">
                        <input ligerui="width: 82" name="availableAmountMin" id="availableAmountMin" type="text" class="ui-textbox" value="">
                        -
                        <input ligerui="width: 82" name="availableAmountMax" id="availableAmountMax" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">实际到账日</div>
                    <div class="field">
                        <input ligerui="width: 82" name="acceptActualDateMin" id="acceptActualDateMin" type="text" class="ui-datepicker" value="">
                        -
                        <input ligerui="width: 82" name="acceptActualDateMax" id="acceptActualDateMax" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">导入日期</div>
                    <div class="field">
                        <input ligerui="width: 82" name="crtTmMin" id="crtTmMin" type="text" class="ui-datepicker" value="">
                        -
                        <input ligerui="width: 82" name="crtTmMax" id="crtTmMax" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                    <%--<span id="confirmBtn" class="sq-button sq-button-round">导出</span>--%>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>

    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capFundPool/fundsHistoryList.do',
            //parms:{},
            method: 'get',
            columns: [
                {display: '资金编号', name: 'code', minWidth: 130, align: 'center', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '<a style="cursor: pointer;" onclick="qyDecompose('+rowdata.fundId+');">'+rowdata.code+'</a>'
                    }
                },
                //{display: '资金状态', name: 'fundStatusCdNm', width: 80, align: 'center', enabledSort: false},
                {display: '收款账号', name: 'acceptCode', minWidth: 100, align: 'center', enabledSort: false},
                {display: '收款账户', name: 'acceptName', minWidth: 100, align: 'center', enabledSort: false},
                {display: '来款账号', name: 'comeCode', minWidth: 100, align: 'left', enabledSort: false},
                {display: '来款户名', name: 'comeName', minWidth: 100, align: 'center', enabledSort: false},
                {display: '收款金额(元)', name: 'amount', width: 90, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(value/100);
                    }
                },
                {display: '实际到账日期', name: 'acceptActualDate', width: 130, align: 'center', enabledSort: false,render:renderDate},
                {display: '导入日期', name: 'fundCrtTm', width: 130, align: 'center', enabledSort: true,render:renderDate},
                {display: '摘要', name: 'docketRem', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (value) {
                            var h = '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.docketRem + '">' + rowdata.docketRem + '</span>';
                            return h;
                        }
                    }
                },
                {display: '转入时间', name: 'intoTime', width: 130, align: 'center', enabledSort: false,render:renderDate},
                {display: '操作人', name: 'intoCrtUserNm', width: 100, align: 'center', enabledSort: false},
                {display: '转/退时间', name: 'applyTime', width: 130, align: 'center', enabledSort: false,render:renderDate},
                {display: '流程编号', name: 'pNo', width: 150, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        var pNo = rowdata.pno;
                        var audStsCd = rowdata.audStsCd;
                        var pInstId = rowdata.pinstId;
                        var dataId = rowdata.businessKey;
                        var h = '<a href="javascript:showFlow(';
                        h += "'" + pInstId + "'";
                        h += ",'" + audStsCd + "'";
                        h += ",'" + dataId + "'";
                        h += ')">' + pNo + '</a>';
                        return h;
                    }
                },
                {display: '退/转款金额(元)', name: 'availableAmt', width: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(value/100);
                    }
                },
                {display: '状态', name: 'audStsCdNm', minWidth: 150, align: 'center', enabledSort: false}
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            isSingleCheck:false,
            rownumbers: true,
            allowUnSelectRow: true
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });
        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });
    });

    //查看分解单
    function qyDecompose(id){
        callback = null;
        Add_navTab('toDecomDtlPage_'+id, "分解单查看", '<%=path%>/capital/capFund/toDecomDtlPage.do?fundId='+id, callback);
    }

    //格式化时间
    function renderDate(rowdata, rowindex, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    function showFlow(_pInstId, _audStsCd, _businessKey) {
        if (StringUtils.isEmpty(_pInstId)) {
            UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
            return;
        }
        var _formUrl = "/capital/capFundPool/toTransIncomePage.do?action=3@@outApplyId=";
        var params = "?pInsId=" + _pInstId + "&status=" + _audStsCd + "&businessKey=" + _businessKey + "&formUrl=" + _formUrl;
        Add_navTab('tab_fund_out_apply_flow_' + _businessKey, '查看流程', "<%=path%>/flow/flow/toFlowShowPageFowBus.do" + params);
    }
</script>

</body>
</html>
